<html>
<head>
	<script>
	  function download_torrent() {

	      chrome.tabs.getSelected(null, function(tab) {
		  var req = new XMLHttpRequest();
		  req.open(
			  "GET",
			  "http://127.0.0.1:12345/" + tab.url,
			  true);
		  req.onload = doneRequest;
		  req.send(null);
	    });
	  }
	  
	  function doneRequest() {
		document.write("Done!");
	  }
	</script>
	<title>Download Torrent</title>
</head>
<body onload="javascript:download_torrent(); ">

</body>
</html>
